const mongoose = require('mongoose')

const HeroSchema = new mongoose.Schema({
  name: { type: String },
  // 这里由于前端绑定的parent就是(下拉框value绑定的)id
  avatar: { type: String },
  title: { type: String },
  // 因为可能一个英雄有多个种类
  categories: [{ type: mongoose.SchemaTypes.ObjectId, ref: 'Category' }],
  scores: {
    difficult: {type: Number},
    skills: {type: Number},
    attack: {type: Number},
    survive: {type: Number}
  },
  skills: [{
    icon: {type: String},
    name: { type:String},
    description: {type:String},
    tips: {type: String}
  }],
  items1: [{ type: mongoose.SchemaTypes.ObjectId, ref: 'Item'} ],
  items2: [{ type: mongoose.SchemaTypes.ObjectId, ref: 'Item'} ],
  usageTips: { type: String },
  battleTips: { type: String },
  teamTips: { type: String },
  partners: [{
    hero: { type:mongoose.SchemaTypes.ObjectId, ref: 'Hero' },
    description: { type: String }
  }]
})

module.exports = mongoose.model('Hero', HeroSchema)